<template>
    <el-dialog :visible.sync="show"
               :title="title"
               :append-to-body="true"
               :close-on-click-modal="false"
               :width="width"
               @closed="remove">
        <component v-bind:is="component" @close="callback" :pdata="data"></component>
    </el-dialog>
</template>

<script>
    export default {
        data() {
            return {
                show: false,
                title: '',
                component: '',
                data: null,
                width: '520px',
                close: () => {
                }
            }
        },
        methods: {
            callback(data) {
                this.show = false;
                this.close(data);
            },
            // 动画执行完毕后删除该抽屉窗口
            remove() {
                let el = this.$el;
                el.parentNode.removeChild(el);
            }
        }
    }
</script>
